Skip to content

chore(warnings): resolve 25 analyzer quick wins and fix RAPS bugs#261

Open
rlorenzo wants to merge 8 commits into
mainfrom
chore/warning-quick-wins
Open

chore(warnings): resolve 25 analyzer quick wins and fix RAPS bugs#261
rlorenzo wants to merge 8 commits into
mainfrom
chore/warning-quick-wins

Conversation

@rlorenzo

@rlorenzo rlorenzo commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Summary

First branch of the .NET warnings cleanup plan: closes 26 of 44 code-analysis warnings via low-risk fixes and justified suppressions, plus four real bugs found along the way (three in RAPS, one latent test hazard). Seven single-purpose commits.

Warning cleanup (26 closed)

Rule Fix
S6967 x11 ModelState guards on 8 RAPS view actions (bad params now 400 instead of proceeding with defaults); justified suppressions on the 2 nav filter overrides; [NonAction] on RAPSController.Nav removes an unintended endpoint
S6964 x5 .editorconfig suppression for ApiPagination (never model-bound, always constructed server-side); GroupAddEdit.GroupId made nullable
CA1505 x3 .editorconfig suppression for scaffolded EF *Context.cs, following the existing S3251 precedent
S6932 x3 Justified suppression (nav filter reads query params for left-nav context only; model binding unavailable in a filter)
S6672 CMS logger created via ILoggerFactory for Data.CMS; log category unchanged
S6931 Directory route prefix moved to controller-level [Route]; all 5 URLs provably unchanged
CA1502 (test ctor) Test ctor mock factories extracted in ServiceLayerIntegrationTest
CA1502 (GetUCD) Directory search query and VMACS enrichment, duplicated verbatim between Get and GetUCD, extracted into shared helpers; SQLite-backed tests pin the query helper (field matches, name-span match, current-user filter, ordering)

Bug fixes (behavior changes to note)

  • AdGroupsController.UpdateGroup: missing return meant a PUT with a mismatched group ID fell through and updated the group anyway; now 400. Regression test added (the group-edit UI always sends a matching ID, so normal use is unaffected).
  • RAPS nav member lookup: SingleAsync 500ed every RAPS page when ?memberId= matched no user; now SingleOrDefaultAsync with the existing null handling.
  • RAPS action pipeline ran twice: OnActionExecutionAsync awaited both the AreaController base (which already invokes next()) and next() again.
  • GroupSync background sync: fire-and-forget task captured the request-scoped RAPSContext (disposed when the response returns); now resolves a fresh context from IServiceScopeFactory and logs failures.

Verification

  • Clean verify:build: all 26 targeted warnings gone, no new ones; the 18 remaining warnings match the plan's deferred list exactly
  • Full backend suite green (now 2,208 tests) on every commit via pre-commit hooks
  • Playwright smoke on dev: RAPS pages incl. bogus deep-links (?roleId=abc 400, nonexistent ?memberId= 200), mismatched-ID group PUT 400, all 5 Directory endpoints, CTS index

@rlorenzo

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@codecov-commenter

Copy link
Copy Markdown

Bundle Report

Bundle size has no change ✅

@codecov-commenter

codecov-commenter commented Jul 17, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 50.00000% with 37 lines in your changes missing coverage. Please review.
✅ Project coverage is 45.59%. Comparing base (e029c14) to head (7ac4816).

Files with missing lines Patch % Lines
...Areas/Directory/Controllers/DirectoryController.cs 35.48% 20 Missing ⚠️
web/Areas/RAPS/Controllers/RAPSController.cs 61.53% 13 Missing and 2 partials ⚠️
web/Areas/CMS/Controllers/CMSController.cs 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #261      +/-   ##
==========================================
+ Coverage   45.39%   45.59%   +0.20%     
==========================================
  Files         916      916              
  Lines       52784    52806      +22     
  Branches     5005     5014       +9     
==========================================
+ Hits        23960    24076     +116     
+ Misses      28196    28097      -99     
- Partials      628      633       +5     
Flag Coverage Δ
backend 45.64% <50.00%> (+0.21%) ⬆️
frontend 44.76% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

@coderabbitai

coderabbitai Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The PR adds RAPS request validation and scoped background synchronization, fixes group-update status handling, consolidates Directory routing and search logic, expands controller tests, refactors test wiring and CMS logging, and updates analyzer suppressions.

Changes

RAPS group management

Layer / File(s) Summary
RAPS validation and background synchronization
web/Areas/RAPS/Models/GroupAddEdit.cs, web/Areas/RAPS/Controllers/RAPSController.cs
RAPS actions validate model state, group synchronization runs in a fresh DI scope with a new context, missing users are tolerated, and failures are logged.
RAPS action validation coverage
test/RAPS/RAPSControllerTests.cs
Tests cover invalid model state, existing and missing records, and missing-group synchronization without scope creation.
Mismatched group update handling
web/Areas/RAPS/Controllers/AdGroupsController.cs, test/RAPS/AdGroupsControllerTests.cs
Mismatched group identifiers return bad requests, and the test verifies stored group fields remain unchanged.

Directory routing and search

Layer / File(s) Summary
Directory route and search consolidation
web/Areas/Directory/Controllers/DirectoryController.cs
Directory routes use a shared area prefix; AAUD search and VMACS enrichment are centralized in reusable helpers.
Directory search query coverage
test/Directory/DirectoryControllerTests.cs
SQLite-backed tests cover identifier and name matching, current-user filtering, ordering, and the reduced AAUD test model.

Test and controller wiring

Layer / File(s) Summary
Clinical Scheduler test dependency setup
test/ClinicalScheduler/Integration/ServiceLayerIntegrationTest.cs
The constructor now owns service wiring, while mock factory methods return instances without side effects.
CMS logger creation
web/Areas/CMS/Controllers/CMSController.cs
CMSController accepts ILoggerFactory and creates its typed logger internally.

Diagnostic suppression maintenance

Layer / File(s) Summary
Analyzer suppression alignment
.editorconfig, web/Areas/CTS/Controllers/CTSController.cs
Analyzer suppressions are expanded for scaffold-generated contexts and ApiPagination, and CTS action-filter code suppresses S6967 locally.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant RAPSController
  participant IServiceScopeFactory
  participant RAPSContext
  participant OuGroupService
  participant NLog
  RAPSController->>RAPSController: Validate GroupSync ModelState
  RAPSController->>IServiceScopeFactory: CreateScope()
  IServiceScopeFactory->>RAPSContext: Resolve fresh context
  RAPSController->>OuGroupService: Sync group
  OuGroupService-->>RAPSController: Complete or throw
  RAPSController->>NLog: Log synchronization failure
Loading

Possibly related PRs

  • ucdavis/VIPER#191: Both PRs modify RAPSController.OnActionExecutionAsync request-path handling.

Suggested reviewers: bsedwards

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 27.42% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title matches the main changes: analyzer warning cleanup and RAPS bug fixes.
Description check ✅ Passed The description directly summarizes the warning cleanup, suppressions, and bug fixes in the changeset.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chore/warning-quick-wins

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@web/Areas/Directory/Controllers/DirectoryController.cs`:
- Line 35: Update the Directory home action route in DirectoryController to
preserve the trailing slash, using an area-root route that resolves to
/Directory/; alternatively, add a redirect from /Directory to /Directory/.
Ensure relative "nav" requests continue resolving under the Directory path.

In `@web/Areas/RAPS/Controllers/RAPSController.cs`:
- Around line 94-99: Update the read-only queries in Nav, specifically the
TblRoles, TblPermissions, and VwAaudUser lookups, to use AsNoTracking() before
execution while preserving their existing filters and null-handling behavior.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: b12c4003-6bfe-4fe7-9c83-98cd8619e44c

📥 Commits

Reviewing files that changed from the base of the PR and between 0c5ab2b and 0375aea.

📒 Files selected for processing (9)
  • .editorconfig
  • test/ClinicalScheduler/Integration/ServiceLayerIntegrationTest.cs
  • test/RAPS/AdGroupsControllerTests.cs
  • web/Areas/CMS/Controllers/CMSController.cs
  • web/Areas/CTS/Controllers/CTSController.cs
  • web/Areas/Directory/Controllers/DirectoryController.cs
  • web/Areas/RAPS/Controllers/AdGroupsController.cs
  • web/Areas/RAPS/Controllers/RAPSController.cs
  • web/Areas/RAPS/Models/GroupAddEdit.cs

Comment thread web/Areas/Directory/Controllers/DirectoryController.cs
Comment thread web/Areas/RAPS/Controllers/RAPSController.cs Outdated
@rlorenzo
rlorenzo force-pushed the chore/warning-quick-wins branch from 0375aea to bd4a19f Compare July 17, 2026 07:26
@rlorenzo

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@rlorenzo
rlorenzo requested a review from Copilot July 17, 2026 07:42
@coderabbitai

coderabbitai Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR is the first tranche of the .NET analyzer-warning cleanup plan for VIPER’s ASP.NET backend, combining low-risk warning fixes/suppressions with a few behavior-correctness fixes discovered during the cleanup (notably in RAPS and one API bug).

Changes:

  • Fixes several real behavior bugs (e.g., AdGroups PUT ID mismatch fallthrough; RAPS SingleAsync -> SingleOrDefaultAsync; RAPS action pipeline double-execution; request-scoped DbContext capture in background sync).
  • Adds ModelState guards to multiple RAPS actions and uses targeted analyzer suppressions/[NonAction] where appropriate.
  • Refactors a test constructor to reduce complexity and adds a regression test for the AdGroups update bug.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
web/Areas/RAPS/Models/GroupAddEdit.cs Makes GroupId nullable to better represent “new group” semantics and satisfy analyzer guidance.
web/Areas/RAPS/Controllers/RAPSController.cs Fixes filter pipeline double-execution, hardens nav member lookup, and moves OU sync to a background scope.
web/Areas/RAPS/Controllers/AdGroupsController.cs Fixes missing return on mismatched PUT ID to prevent unintended updates.
web/Areas/Directory/Controllers/DirectoryController.cs Consolidates route prefix at controller level while keeping endpoints consistent.
web/Areas/CTS/Controllers/CTSController.cs Adds targeted analyzer suppression for filter override.
web/Areas/CMS/Controllers/CMSController.cs Uses ILoggerFactory to create a Data.CMS-category logger without triggering the analyzer.
test/RAPS/AdGroupsControllerTests.cs Adds regression coverage for the mismatched group ID PUT bug.
test/ClinicalScheduler/Integration/ServiceLayerIntegrationTest.cs Extracts mock factories to reduce constructor complexity.
.editorconfig Adds/extends justified suppressions for generated contexts and non-bound model types.

Comment thread web/Areas/RAPS/Controllers/RAPSController.cs Outdated
@rlorenzo
rlorenzo force-pushed the chore/warning-quick-wins branch 2 times, most recently from 03058c4 to d230b4e Compare July 18, 2026 00:56
Comment thread web/Areas/Directory/Controllers/DirectoryController.cs Fixed
@rlorenzo
rlorenzo force-pushed the chore/warning-quick-wins branch from 45e0335 to 9a65086 Compare July 20, 2026 18:19
@rlorenzo

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 20, 2026

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
web/Areas/Directory/Controllers/DirectoryController.cs (2)

90-97: 🚀 Performance & Scalability | 🟠 Major | ⚡ Quick win

Avoid nested per-item searches.

Using .Find() inside a loop over a collection causes O(N*M) time complexity. As per coding guidelines, pre-build a Dictionary (or Lookup) and use it to look up items within the loop.

⚡ Proposed fix
+            var individualsByIamId = individuals
+                .Where(m => m.IamId != null)
+                .GroupBy(m => m.IamId)
+                .ToDictionary(g => g.Key, g => g.First());
+
             foreach (var l in ldap)
             {
-                AaudUser? userInfo = individuals.Find(m => m.IamId == l.IamId);
+                individualsByIamId.TryGetValue(l.IamId ?? string.Empty, out var userInfo);
                 var result = hasDetailPermission
                     ? new IndividualSearchResultWithIDs(userInfo, l)
                     : new IndividualSearchResult(userInfo, l);
                 result.LookupEmailHost(_aaud);
                 results.Add(result);
                 AddVmacsContactInfo(result);
             }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@web/Areas/Directory/Controllers/DirectoryController.cs` around lines 90 - 97,
Replace the per-item individuals.Find call in the ldap iteration with a
pre-built Dictionary or Lookup keyed by IamId, created before the loop. Retrieve
each AaudUser through that index while preserving the existing result
construction, LookupEmailHost, and results.Add behavior.

Source: Coding guidelines


61-74: 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Use .Select() for mapping.
Both methods manually iterate and append items to a List instead of using LINQ .Select(). As per coding guidelines, use .Select() for mapping rather than foreach + Add.

  • web/Areas/Directory/Controllers/DirectoryController.cs#L61-L74: Refactor individuals.ForEach to map elements using .Select().
  • web/Areas/Directory/Controllers/DirectoryController.cs#L85-L101: Refactor foreach (var l in ldap) similarly.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@web/Areas/Directory/Controllers/DirectoryController.cs` around lines 61 - 74,
Replace the manual list construction and individuals.ForEach mapping in
DirectoryController.cs lines 61-74 with a LINQ Select projection that preserves
permission-based result creation, LookupEmailHost, and AddVmacsContactInfo
behavior. Apply the same Select-based mapping refactor to the ldap loop in
DirectoryController.cs lines 85-101, with no direct changes required beyond
converting that loop to projection.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@web/Areas/Directory/Controllers/DirectoryController.cs`:
- Around line 135-145: Update AddVmacsContactInfo to return async Task and await
VMACSService.Search instead of accessing .Result; then update every caller in
DirectoryController to await this helper and propagate async Task as needed,
preserving the existing result-mapping behavior.

In `@web/Areas/RAPS/Controllers/RAPSController.cs`:
- Around line 302-305: Extract the repeated ModelState.IsValid checks from the
affected RAPSController actions into a shared ValidateModelStateAttribute action
filter that returns BadRequestResult when validation fails. Apply the filter
consistently to all eight affected actions, then remove their inline guards
while preserving the existing action behavior for valid model state.
- Around line 599-631: Update the background-job entry point
SyncGroupInBackground to catch and log every Exception, rather than filtering to
a limited set of exception types. Preserve the existing error context and
groupId in LogManager logging so unexpected failures, including database
exceptions such as SqlException, are observed.

---

Outside diff comments:
In `@web/Areas/Directory/Controllers/DirectoryController.cs`:
- Around line 90-97: Replace the per-item individuals.Find call in the ldap
iteration with a pre-built Dictionary or Lookup keyed by IamId, created before
the loop. Retrieve each AaudUser through that index while preserving the
existing result construction, LookupEmailHost, and results.Add behavior.
- Around line 61-74: Replace the manual list construction and
individuals.ForEach mapping in DirectoryController.cs lines 61-74 with a LINQ
Select projection that preserves permission-based result creation,
LookupEmailHost, and AddVmacsContactInfo behavior. Apply the same Select-based
mapping refactor to the ldap loop in DirectoryController.cs lines 85-101, with
no direct changes required beyond converting that loop to projection.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: ffb720a2-d3a4-4cd4-9d60-e2daa11f438e

📥 Commits

Reviewing files that changed from the base of the PR and between 0375aea and 9a65086.

📒 Files selected for processing (11)
  • .editorconfig
  • test/ClinicalScheduler/Integration/ServiceLayerIntegrationTest.cs
  • test/Directory/DirectoryControllerTests.cs
  • test/RAPS/AdGroupsControllerTests.cs
  • test/RAPS/RAPSControllerTests.cs
  • web/Areas/CMS/Controllers/CMSController.cs
  • web/Areas/CTS/Controllers/CTSController.cs
  • web/Areas/Directory/Controllers/DirectoryController.cs
  • web/Areas/RAPS/Controllers/AdGroupsController.cs
  • web/Areas/RAPS/Controllers/RAPSController.cs
  • web/Areas/RAPS/Models/GroupAddEdit.cs

Comment thread web/Areas/Directory/Controllers/DirectoryController.cs Outdated
Comment thread web/Areas/RAPS/Controllers/RAPSController.cs
Comment thread web/Areas/RAPS/Controllers/RAPSController.cs
@rlorenzo
rlorenzo force-pushed the chore/warning-quick-wins branch from 9a65086 to 902911b Compare July 21, 2026 00:03
Comment thread web/Areas/RAPS/Controllers/RAPSController.cs
Comment thread web/Areas/RAPS/Controllers/RAPSController.cs Dismissed
@rlorenzo

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@web/Areas/Directory/Controllers/DirectoryController.cs`:
- Line 87: Replace the linear per-item individuals.Find lookup in the
surrounding directory search flow with a ToLookup-based index created once from
individuals before the loop. Use the lookup inside the loop to retrieve matching
users in O(1), preserving the existing matching key and result behavior.

In `@web/Areas/RAPS/Controllers/RAPSController.cs`:
- Around line 26-27: Remove the unused Count and UserName properties from the
RAPSController class, leaving the remaining controller state and behavior
unchanged.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: a1efe47d-ff84-4d5d-b8b1-9564bdc5e7e3

📥 Commits

Reviewing files that changed from the base of the PR and between 9a65086 and 902911b.

📒 Files selected for processing (4)
  • test/Directory/DirectoryControllerTests.cs
  • test/RAPS/RAPSControllerTests.cs
  • web/Areas/Directory/Controllers/DirectoryController.cs
  • web/Areas/RAPS/Controllers/RAPSController.cs

Comment thread web/Areas/Directory/Controllers/DirectoryController.cs
Comment thread web/Areas/RAPS/Controllers/RAPSController.cs

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.

Comment thread web/Areas/Directory/Controllers/DirectoryController.cs
Comment thread web/Areas/RAPS/Controllers/RAPSController.cs Outdated
- suppress CA1505 for scaffolded EF contexts and S6964 for
  ApiPagination, which is never model-bound (editorconfig precedent)
- create the Data.CMS logger via ILoggerFactory so the logger
  category matches its consumer (S6672)
- move the Directory route prefix to the controller, URLs unchanged
  (S6931)
- return 400 from RAPS view actions when model binding fails instead
  of proceeding with defaulted params (S6967)
- suppress S6967/S6932 on the RAPS and CTS nav filter overrides with
  justification; mark RAPSController.Nav [NonAction] to remove an
  unintended endpoint
- make GroupAddEdit.GroupId nullable to reflect create semantics
  (S6964)
rlorenzo added 7 commits July 20, 2026 17:53
Splits the two large NSubstitute fakes out of
ServiceLayerIntegrationTest constructor (CA1502); behavior unchanged.
The BadRequest result was discarded, so a PUT whose body groupId did
not match the route fell through and updated the group anyway. Add a
regression test asserting the 400 and that the group is unchanged.
SingleAsync threw on every RAPS page when the memberId query param
matched no user; the nav already handles the null case.
OnActionExecutionAsync awaited both the AreaController base, which
already invokes next(), and next() again, so every RAPS action ran
its pipeline twice.
The fire-and-forget sync captured the request-scoped RAPSContext,
which is disposed once the response returns, faulting the background
task. Resolve a fresh context from IServiceScopeFactory and log
failures instead of leaving them unobserved.
Unit-locks the new 400-on-binding-failure behavior for all 8 guarded
RAPS view actions and covers the permission lookup found/not-found
paths plus the GroupSync no-op path (no background sync for unknown
groups). Raises the PR patch coverage flagged by Codecov.
- Closes the CA1502 warning on GetUCD; the shared query helper and the
  VMACS enrichment were duplicated verbatim across both actions
- SQLite-backed tests pin the query helper (field matches, name-span
  match, current-user filter, ordering)

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 11 out of 11 changed files in this pull request and generated 1 comment.

Comment thread web/Areas/CMS/Controllers/CMSController.cs
@rlorenzo

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@web/Areas/Directory/Controllers/DirectoryController.cs`:
- Around line 108-114: Update DirectoryResult to return the synchronous View
result directly without wrapping it in Task.Run, adjusting the method signature
as needed to match its synchronous behavior. Rename the XML parameter
documentation and inline comment references from uid to mothraID.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 01f93fff-c33a-48ec-9153-c68e6a343460

📥 Commits

Reviewing files that changed from the base of the PR and between 902911b and 7ac4816.

📒 Files selected for processing (11)
  • .editorconfig
  • test/ClinicalScheduler/Integration/ServiceLayerIntegrationTest.cs
  • test/Directory/DirectoryControllerTests.cs
  • test/RAPS/AdGroupsControllerTests.cs
  • test/RAPS/RAPSControllerTests.cs
  • web/Areas/CMS/Controllers/CMSController.cs
  • web/Areas/CTS/Controllers/CTSController.cs
  • web/Areas/Directory/Controllers/DirectoryController.cs
  • web/Areas/RAPS/Controllers/AdGroupsController.cs
  • web/Areas/RAPS/Controllers/RAPSController.cs
  • web/Areas/RAPS/Models/GroupAddEdit.cs

Comment thread web/Areas/Directory/Controllers/DirectoryController.cs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants